/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is Forte for Java, Community Edition. The Initial * Developer of the Original Code is Sun Microsystems, Inc. Portions * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.javadoc.comments; import java.io.*; import java.util.ResourceBundle; import java.lang.reflect.Modifier; import javax.swing.*; import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionEvent; import java.text.MessageFormat; import org.openide.TopManager; import org.openide.DialogDescriptor; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; import org.netbeans.modules.javadoc.settings.DocumentationSettings; /** The form for AutoComment dialog * * @author Petr Hrebejk * @version */ public class AutoCommentPanel extends javax.swing.JPanel implements ListSelectionListener { AutoCommenter autoCommenter; private static final DefaultListModel EMPTY_MODEL = new DefaultListModel(); static final String WAIT_STRING = "WAIT.MODEL"; // NOI18N private static final DefaultListModel WAIT_MODEL = new DefaultListModel(); static { WAIT_MODEL.addElement( WAIT_STRING ); } private static final ImageIcon publicIcon = new ImageIcon (AutoCommentPanel.class.getResource ("/org/netbeans/modules/javadoc/comments/resources/public.gif")); // NOI18N private static final ImageIcon protectedIcon = new ImageIcon (AutoCommentPanel.class.getResource ("/org/netbeans/modules/javadoc/comments/resources/protected.gif")); // NOI18N private static final ImageIcon packageIcon = new ImageIcon (AutoCommentPanel.class.getResource ("/org/netbeans/modules/javadoc/comments/resources/package.gif")); // NOI18N private static final ImageIcon privateIcon = new ImageIcon (AutoCommentPanel.class.getResource ("/org/netbeans/modules/javadoc/comments/resources/private.gif")); // NOI18N private static final ImageIcon okIcon = new ImageIcon (AutoCommentPanel.class.getResource ("/org/netbeans/modules/javadoc/comments/resources/ok.gif")); // NOI18N private static final ImageIcon errorIcon = new ImageIcon (AutoCommentPanel.class.getResource ("/org/netbeans/modules/javadoc/comments/resources/error.gif")); // NOI18N private static final ImageIcon missIcon = new ImageIcon (AutoCommentPanel.class.getResource ("/org/netbeans/modules/javadoc/comments/resources/missing.gif")); // NOI18N private static final ResourceBundle bundle = NbBundle.getBundle( AutoCommenter.class ); private int modifierMask; private int errorMask; static final long serialVersionUID =1845033305150331568L; /** Creates new form AutoCommentPanel */ public AutoCommentPanel() { initComponents (); okButton.setIcon( okIcon ); errButton.setIcon( errorIcon ); missButton.setIcon( missIcon ); publicButton.setIcon( publicIcon ); packageButton.setIcon( packageIcon ); protectedButton.setIcon( protectedIcon ); privateButton.setIcon( privateIcon ); resolveButtonState(); int sel = badList.getMinSelectionIndex(); if ( sel < 0 ) { defaultButton.setEnabled( false ); customizeButton.setEnabled( false ); } badList.setCellRenderer( new AutoCommentListCellRenderer() ); detailsPanel.setBorder (new javax.swing.border.TitledBorder( new javax.swing.border.EtchedBorder(), org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.detailsPanel.border") ) ); elementSelection( new ListSelectionEvent( badList, -1, -1, false ) ); } public java.awt.Dimension getPreferredSize () { java.awt.Dimension sup = super.getPreferredSize (); //return new java.awt.Dimension ( Math.max (sup.width, 300), Math.max (sup.height, 400 )); return new java.awt.Dimension ( 350, Math.max (sup.height, 400 )); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. */ private void initComponents () {//GEN-BEGIN:initComponents filterPanel = new javax.swing.JPanel (); okButton = new javax.swing.JToggleButton (); errButton = new javax.swing.JToggleButton (); missButton = new javax.swing.JToggleButton (); publicButton = new javax.swing.JToggleButton (); packageButton = new javax.swing.JToggleButton (); protectedButton = new javax.swing.JToggleButton (); privateButton = new javax.swing.JToggleButton (); jPanel2 = new javax.swing.JPanel (); jScrollPane1 = new javax.swing.JScrollPane (); badList = new javax.swing.JList (); buttonPanel = new javax.swing.JPanel (); customizeButton = new javax.swing.JButton (); defaultButton = new javax.swing.JButton (); sourceButton = new javax.swing.JButton (); refreshButton = new javax.swing.JButton (); jPanel3 = new javax.swing.JPanel (); detailsPanel = new javax.swing.JPanel (); nameLabel = new javax.swing.JLabel (); classTextField = new javax.swing.JTextField (); jScrollPane2 = new javax.swing.JScrollPane (); errorListBox = new javax.swing.JList (); setLayout (new java.awt.GridBagLayout ()); java.awt.GridBagConstraints gridBagConstraints1; setBorder (new javax.swing.border.EmptyBorder(new java.awt.Insets(5, 5, 5, 5))); filterPanel.setLayout (new java.awt.GridBagLayout ()); java.awt.GridBagConstraints gridBagConstraints2; okButton.setToolTipText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.okButton.toolTipText")); okButton.setMargin (new java.awt.Insets(2, 2, 2, 2)); okButton.setSelected (true); okButton.setActionCommand ("ALL"); // NOI18N okButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { okButtonActionPerformed (evt); } } ); gridBagConstraints2 = new java.awt.GridBagConstraints (); filterPanel.add (okButton, gridBagConstraints2); errButton.setToolTipText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.errButton.toolTipText")); errButton.setMargin (new java.awt.Insets(2, 2, 2, 2)); errButton.setSelected (true); errButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { errButtonActionPerformed (evt); } } ); gridBagConstraints2 = new java.awt.GridBagConstraints (); filterPanel.add (errButton, gridBagConstraints2); missButton.setToolTipText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.missButton.toolTipText")); missButton.setMargin (new java.awt.Insets(2, 2, 2, 2)); missButton.setSelected (true); missButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { missButtonActionPerformed (evt); } } ); gridBagConstraints2 = new java.awt.GridBagConstraints (); gridBagConstraints2.insets = new java.awt.Insets (0, 0, 0, 6); filterPanel.add (missButton, gridBagConstraints2); publicButton.setToolTipText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.publicButton.toolTipText")); publicButton.setMargin (new java.awt.Insets(2, 2, 2, 2)); publicButton.setSelected (true); publicButton.setActionCommand ("PUBLIC"); // NOI18N publicButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { publicButtonActionPerformed (evt); } } ); gridBagConstraints2 = new java.awt.GridBagConstraints (); filterPanel.add (publicButton, gridBagConstraints2); packageButton.setToolTipText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.packageButton.toolTipText")); packageButton.setMargin (new java.awt.Insets(2, 2, 2, 2)); packageButton.setActionCommand ("PACKAGE"); // NOI18N packageButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { packageButtonActionPerformed (evt); } } ); gridBagConstraints2 = new java.awt.GridBagConstraints (); filterPanel.add (packageButton, gridBagConstraints2); protectedButton.setToolTipText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.protectedButton.toolTipText")); protectedButton.setMargin (new java.awt.Insets(2, 2, 2, 2)); protectedButton.setSelected (true); protectedButton.setActionCommand ("PROTECTED"); // NOI18N protectedButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { protectedButtonActionPerformed (evt); } } ); gridBagConstraints2 = new java.awt.GridBagConstraints (); filterPanel.add (protectedButton, gridBagConstraints2); privateButton.setToolTipText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.privateButton.toolTipText")); privateButton.setMargin (new java.awt.Insets(2, 2, 2, 2)); privateButton.setActionCommand ("PRIVATE"); // NOI18N privateButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { privateButtonActionPerformed (evt); } } ); gridBagConstraints2 = new java.awt.GridBagConstraints (); filterPanel.add (privateButton, gridBagConstraints2); gridBagConstraints2 = new java.awt.GridBagConstraints (); gridBagConstraints2.weightx = 1.0; filterPanel.add (jPanel2, gridBagConstraints2); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints1.insets = new java.awt.Insets (0, 0, 5, 0); gridBagConstraints1.weightx = 1.0; add (filterPanel, gridBagConstraints1); jScrollPane1.setViewportView (badList); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.weightx = 0.6; gridBagConstraints1.weighty = 1.0; add (jScrollPane1, gridBagConstraints1); buttonPanel.setLayout (new java.awt.GridBagLayout ()); java.awt.GridBagConstraints gridBagConstraints3; buttonPanel.setBorder (new javax.swing.border.EmptyBorder(new java.awt.Insets(0, 5, 0, 0))); customizeButton.setMargin (new java.awt.Insets(2, 4, 2, 4)); customizeButton.setText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.customizeButton.text")); customizeButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { customizeButtonActionPerformed (evt); } } ); gridBagConstraints3 = new java.awt.GridBagConstraints (); gridBagConstraints3.gridwidth = 0; gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL; buttonPanel.add (customizeButton, gridBagConstraints3); defaultButton.setMargin (new java.awt.Insets(2, 4, 2, 4)); defaultButton.setText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.defaultButton.text")); defaultButton.setActionCommand ("Default Comment"); // NOI18N defaultButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { defaultButtonActionPerformed (evt); } } ); gridBagConstraints3 = new java.awt.GridBagConstraints (); gridBagConstraints3.gridwidth = 0; gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTH; buttonPanel.add (defaultButton, gridBagConstraints3); sourceButton.setMargin (new java.awt.Insets(2, 4, 2, 4)); sourceButton.setText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.sourceButton.text")); sourceButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { sourceButtonActionPerformed (evt); } } ); gridBagConstraints3 = new java.awt.GridBagConstraints (); gridBagConstraints3.gridwidth = 0; gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints3.insets = new java.awt.Insets (4, 0, 0, 0); buttonPanel.add (sourceButton, gridBagConstraints3); refreshButton.setMargin (new java.awt.Insets(2, 4, 2, 4)); refreshButton.setText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("CTL_AutoCommentPanel.refreshButton.text")); refreshButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { refreshButtonActionPerformed (evt); } } ); gridBagConstraints3 = new java.awt.GridBagConstraints (); gridBagConstraints3.gridwidth = 0; gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 0); gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTH; buttonPanel.add (refreshButton, gridBagConstraints3); gridBagConstraints3 = new java.awt.GridBagConstraints (); gridBagConstraints3.weighty = 1.0; buttonPanel.add (jPanel3, gridBagConstraints3); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints1.weighty = 0.6; add (buttonPanel, gridBagConstraints1); detailsPanel.setLayout (new java.awt.GridBagLayout ()); java.awt.GridBagConstraints gridBagConstraints4; nameLabel.setText (org.openide.util.NbBundle.getBundle(AutoCommentPanel.class).getString("AutoCommentPanel.nameLabel.text")); gridBagConstraints4 = new java.awt.GridBagConstraints (); gridBagConstraints4.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints4.insets = new java.awt.Insets (4, 6, 4, 0); detailsPanel.add (nameLabel, gridBagConstraints4); classTextField.setEditable (false); gridBagConstraints4 = new java.awt.GridBagConstraints (); gridBagConstraints4.gridwidth = 0; gridBagConstraints4.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints4.insets = new java.awt.Insets (4, 4, 4, 6); gridBagConstraints4.weightx = 1.0; detailsPanel.add (classTextField, gridBagConstraints4); jScrollPane2.setViewportView (errorListBox); gridBagConstraints4 = new java.awt.GridBagConstraints (); gridBagConstraints4.gridwidth = 0; gridBagConstraints4.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints4.insets = new java.awt.Insets (4, 4, 4, 4); gridBagConstraints4.weightx = 1.0; gridBagConstraints4.weighty = 1.0; detailsPanel.add (jScrollPane2, gridBagConstraints4); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.weighty = 0.4; add (detailsPanel, gridBagConstraints1); }//GEN-END:initComponents private void missButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_missButtonActionPerformed resolveMask(); prepareModel(); }//GEN-LAST:event_missButtonActionPerformed private void errButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_errButtonActionPerformed resolveMask(); prepareModel(); }//GEN-LAST:event_errButtonActionPerformed private void okButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed resolveMask(); prepareModel(); }//GEN-LAST:event_okButtonActionPerformed private void refreshButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed autoCommenter.refreshFromSource(); prepareModel(); }//GEN-LAST:event_refreshButtonActionPerformed private void privateButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_privateButtonActionPerformed resolveMask(); prepareModel(); }//GEN-LAST:event_privateButtonActionPerformed private void protectedButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_protectedButtonActionPerformed resolveMask(); prepareModel(); }//GEN-LAST:event_protectedButtonActionPerformed private void packageButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_packageButtonActionPerformed resolveMask(); prepareModel(); }//GEN-LAST:event_packageButtonActionPerformed private void publicButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_publicButtonActionPerformed resolveMask(); prepareModel(); }//GEN-LAST:event_publicButtonActionPerformed private void customizeButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customizeButtonActionPerformed int sel = badList.getMinSelectionIndex(); if ( sel == -1 ) return; showCommentEditor( (AutoCommenter.Element)badList.getModel().getElementAt( sel ) ); DefaultListModel badModel = (DefaultListModel)badList.getModel(); AutoCommenter.Element element = (AutoCommenter.Element)badModel.getElementAt( sel ); badModel.removeElementAt( sel ); element.checkError(); if ( AutoCommenter.acceptElement( element, modifierMask, packageButton.isSelected(), errorMask ) ) { badModel.add( sel, element ); badList.getSelectionModel().setSelectionInterval( sel, sel ); } //errorListBox.setModel( element.getErrorList() ); //badList.repaint(); //errorListBox.repaint(); }//GEN-LAST:event_customizeButtonActionPerformed private void defaultButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_defaultButtonActionPerformed int sel = badList.getMinSelectionIndex(); if ( sel == -1 ) return; //((AutoCommenter.Element)badList.getModel().getElementAt( sel )).generateDefaultComment(); AutoCommenter.Element element = (AutoCommenter.Element)badList.getModel().getElementAt( sel ); try { element.autoCorrect(); customizeButtonActionPerformed(evt); } catch (org.openide.src.SourceException e) { TopManager.getDefault().notify(new NotifyDescriptor.Exception(e)); } }//GEN-LAST:event_defaultButtonActionPerformed private void sourceButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sourceButtonActionPerformed int sel = badList.getMinSelectionIndex(); if ( sel == -1 ) return; ((AutoCommenter.Element)badList.getModel().getElementAt( sel )).viewSource(); }//GEN-LAST:event_sourceButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel filterPanel; private javax.swing.JToggleButton okButton; private javax.swing.JToggleButton errButton; private javax.swing.JToggleButton missButton; private javax.swing.JToggleButton publicButton; private javax.swing.JToggleButton packageButton; private javax.swing.JToggleButton protectedButton; private javax.swing.JToggleButton privateButton; private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JList badList; private javax.swing.JPanel buttonPanel; private javax.swing.JButton customizeButton; private javax.swing.JButton defaultButton; private javax.swing.JButton sourceButton; private javax.swing.JButton refreshButton; private javax.swing.JPanel jPanel3; private javax.swing.JPanel detailsPanel; private javax.swing.JLabel nameLabel; private javax.swing.JTextField classTextField; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JList errorListBox; // End of variables declaration//GEN-END:variables private void showCommentEditor( final AutoCommenter.Element el ) { final JavaDocEditorPanel editorPanel = new JavaDocEditorPanel( el.getJavaDoc(), el.getSrcElement()); DialogDescriptor dd = new DialogDescriptor( editorPanel, MessageFormat.format( bundle.getString( "CTL_TITLE_JavaDocComment" ), new Object[] { el.getName() } ), //Title true, // Modal NotifyDescriptor.OK_CANCEL_OPTION, // Option list NotifyDescriptor.OK_OPTION, // Default DialogDescriptor.BOTTOM_ALIGN, // Align null, // Help null ); java.awt.Dialog dialog = TopManager.getDefault().createDialog( dd ); dialog.show (); if ( dd.getValue().equals( NotifyDescriptor.OK_OPTION ) ) { final org.openide.src.SourceException[] exc = { null }; try { el.modifyJavaDoc(new Runnable() { public void run() { try { el.getJavaDoc().setRawText( editorPanel.getRawText() ); } catch (org.openide.src.SourceException e) { exc[0] = e; } } }); } catch (org.openide.src.SourceException ex ) { exc[0] = ex; } if (exc[0] != null) { org.openide.TopManager.getDefault().notify(new NotifyDescriptor.Exception(exc[0])); } } } private void elementSelection( ListSelectionEvent evt ) { int sel = badList.getMinSelectionIndex(); ListModel badListModel = badList.getModel(); if ( sel < 0 ) { errorListBox.setModel(EMPTY_MODEL); defaultButton.setEnabled( false ); customizeButton.setEnabled( false ); sourceButton.setEnabled( false ); classTextField.setText( "" ); // NOI18N } else { AutoCommenter.Element element = (AutoCommenter.Element)badListModel.getElementAt( sel ); try { classTextField.setText( element.getSrcElement().getDeclaringClass().getName().getFullName() ); } catch ( NullPointerException e ) { classTextField.setText( element.getSrcElement().getName().getFullName() ); } customizeButton.setEnabled( true ); defaultButton.setEnabled( element.isCorrectable() ); sourceButton.setEnabled( true ); errorListBox.setModel( element.getErrorList() ); } } void setAutoCommenter( AutoCommenter autoCommenter ) { badList.setModel( WAIT_MODEL ); this.autoCommenter = autoCommenter; RequestProcessor.postRequest( new Refresher() ); } private void resolveMask() { modifierMask = 0; errorMask = 0; if ( publicButton.isSelected() ) modifierMask |= Modifier.PUBLIC; if ( protectedButton.isSelected() ) modifierMask |= Modifier.PROTECTED; if ( privateButton.isSelected() ) modifierMask |= Modifier.PRIVATE; if ( okButton.isSelected() ) errorMask |= AutoCommenter.JDC_OK; if ( errButton.isSelected() ) errorMask |= AutoCommenter.JDC_ERROR; if ( missButton.isSelected() ) errorMask |= AutoCommenter.JDC_MISSING; DocumentationSettings ds = new DocumentationSettings(); ds.setAutocommentModifierMask( modifierMask ); ds.setAutocommentPackage( packageButton.isSelected() ); ds.setAutocommentErrorMask( errorMask ); } private void prepareModel() { badList.getSelectionModel().removeListSelectionListener( this ); badList.setModel( autoCommenter.prepareListModel( modifierMask, packageButton.isSelected(), errorMask ) ); badList.getSelectionModel().setSelectionMode( javax.swing.ListSelectionModel.SINGLE_SELECTION ); badList.getSelectionModel().addListSelectionListener( this ); errorListBox.setModel( EMPTY_MODEL ); } // Impelmentation of externalizable public void resolveButtonState() { DocumentationSettings ds = new DocumentationSettings(); final int modifierMask = ds.getAutocommentModifierMask(); final boolean pckg = ds.getAutocommentPackage(); final int errorMask = ds.getAutocommentErrorMask(); javax.swing.SwingUtilities.invokeLater( new Runnable() { public void run() { publicButton.setSelected( (modifierMask & Modifier.PUBLIC) != 0 ); protectedButton.setSelected( (modifierMask & Modifier.PROTECTED) != 0 ); privateButton.setSelected( (modifierMask & Modifier.PRIVATE) != 0 ); packageButton.setSelected( pckg ); okButton.setSelected( ( errorMask & AutoCommenter.JDC_OK ) != 0 ); errButton.setSelected( ( errorMask & AutoCommenter.JDC_ERROR ) != 0 ); missButton.setSelected( ( errorMask & AutoCommenter.JDC_MISSING) != 0 ); } } ); } // Implementation of ListSelectionListener public void valueChanged(final ListSelectionEvent evt) { elementSelection( evt ); } // InnerClass refreshes from source class Refresher implements Runnable { public void run () { autoCommenter.refreshFromSource(); resolveMask(); javax.swing.SwingUtilities.invokeLater( new Runnable() { public void run () { prepareModel(); } } ); } } } /* * Log * 13 Gandalf-post-FCS1.11.1.0 4/13/00 Svatopluk Dedic Fixed #6252 * 12 Gandalf 1.11 1/12/00 Petr Hrebejk i18n mk2 * 11 Gandalf 1.10 1/12/00 Petr Hrebejk i18n * 10 Gandalf 1.9 1/3/00 Petr Hrebejk Various bugfixes - 4709, * 4978, 5017, 4981, 4976, 5016, 4740, 5005 * 9 Gandalf 1.8 11/27/99 Patrik Knakal * 8 Gandalf 1.7 10/23/99 Ian Formanek NO SEMANTIC CHANGE - Sun * Microsystems Copyright in File Comment * 7 Gandalf 1.6 9/16/99 Petr Hrebejk Tag descriptions editing * in HTML editor + localization * 6 Gandalf 1.5 8/17/99 Petr Hrebejk @return tag check * 5 Gandalf 1.4 8/16/99 Petr Hrebejk Default Comment changed * to Auto-Correct * 4 Gandalf 1.3 8/13/99 Petr Hrebejk Window serialization * added & Tag change button in Jdoc editor removed * 3 Gandalf 1.2 7/30/99 Petr Hrebejk Autocomment made * TopComponent * 2 Gandalf 1.1 7/26/99 Petr Hrebejk AutoComment tool * implemented * 1 Gandalf 1.0 7/9/99 Petr Hrebejk * $ */